package com.yyfax.pay.depository.service.inner;

import com.yyfax.framework.common.OpResponse;
import com.yyfax.pay.common.enums.FuiouBusiTypeEnum;
import com.yyfax.pay.common.enums.PayTypeEnum;
import com.yyfax.pay.depository.domain.FuiouFileDownload;
import com.yyfax.pay.depository.domain.FuiouFileUpload;
import com.yyfax.pay.depository.vo.FuiouDownloadFileVO;
import com.yyfax.pay.depository.vo.FuiouFileQueryVO;
import com.yyfax.pay.depository.vo.FuiouUploadFileVO;
import com.yyfax.pay.third.model.to.file.DownloadNotifyReq;
import com.yyfax.pay.third.model.to.file.QueryNotifyReq;
import com.yyfax.pay.third.model.to.file.UploadNotifyReq;
import com.yyfax.pay.third.model.to.fuioudeposit.UploadFileResultPushReq;
import com.yyfax.pay.vo.depository.DownloadFileReq;
import com.yyfax.pay.vo.depository.FileQueryReq;
import com.yyfax.pay.vo.depository.UploadFileReq;

/**
 * 文件内部服务
 * 
 * @author buyi
 * @date 2017-09-05 19:19:30
 * @since v2.0.0
 */
public interface FuiouDepositFileInnerService {

	/**
	 * 保存上传信息
	 * 
	 * @author buyi
	 * @date 2017-09-07 11:10:05
	 * @since v2.0.0
	 * @param params
	 * @param type 业务类型
	 * @return
	 */
	public FuiouUploadFileVO saveUpload(UploadFileReq params, FuiouBusiTypeEnum type);

	/**
	 * 执行上传
	 * 
	 * @author buyi
	 * @date 2017-09-07 11:49:50
	 * @since v2.0.0
	 * @param vo
	 * @return
	 */
	public FuiouFileUpload doUpload(FuiouUploadFileVO vo);

	/**
	 * 保存信息<br>
	 * 前期整合保存
	 * 
	 * @author buyi
	 * @date 2017-09-05 19:20:54
	 * @since v2.0.0
	 * @param params
	 */
	public FuiouDownloadFileVO saveDownload(DownloadFileReq params, FuiouBusiTypeEnum type);

	/**
	 * 执行下载
	 * 
	 * @author buyi
	 * @date 2017-09-06 09:47:54
	 * @since v2.0.0
	 * @param vo
	 * @return
	 */
	public FuiouFileDownload doDownload(FuiouDownloadFileVO vo);

	/**
	 * 解析来自文件服务的下载文件结果异步通知
	 * 
	 * @author buyi
	 * @date 2017-09-07 17:13:16
	 * @since v2.0.0
	 * @param merchantCode
	 * @param req
	 */
	public void parseDownloadResultForFileServer(String merchantCode, DownloadNotifyReq req);

	/**
	 * 解析来自富友的上传文件处理结果
	 * 
	 * @author buyi
	 * @date 2017-09-08 10:24:55
	 * @since v2.0.0
	 * @param merchantCode
	 * @param req
	 */
	public String parseUploadPushResult(String merchantCode, UploadFileResultPushReq req, PayTypeEnum payTypeEnum);

	/**
	 * 校验文件服务器签名
	 * 
	 * @author buyi
	 * @date 2017-09-15 15:07:21
	 * @since v2.0.0
	 * @param merchantCode
	 * @param sign
	 * @param body
	 */
	public void validFileServerSign(String merchantCode, String sign, String body,PayTypeEnum payTypeEnum);

	/**
	 * 解析来自文件服务的下载结果通知
	 * 
	 * @author buyi
	 * @date 2017-09-20 10:35:33
	 * @since v2.0.0
	 * @param merchantCode
	 * @param req
	 */
	public void parseUploadResultForFileServer(String merchantCode, UploadNotifyReq req);

	/**
	 * 保存查询订单信息
	 * 
	 * @author buyi
	 * @date 2017-10-09 16:40:40
	 * @since v2.0.0
	 * @param params
	 * @param type 文件业务类型 {@link PayTypeEnum.FILE_TRADE}<br>
	 *        {@link PayTypeEnum.FILE_CHECK}
	 * @return
	 */
	public FuiouFileQueryVO saveQueryOrder(FileQueryReq params, PayTypeEnum type);

	/**
	 * 查询回盘文件结果
	 * 
	 * @author buyi
	 * @date 2017-10-09 10:46:14
	 * @since v2.0.0
	 * @param vo
	 * @return 
	 */
	public OpResponse query(FuiouFileQueryVO vo);

	/**
	 * 解析查询异步通知结果
	 * 
	 * @author buyi
	 * @date 2017-10-09 17:13:16
	 * @since v2.0.0
	 * @param merchantCode
	 * @param req
	 * @param type
	 */
	public void parseQueryNotify(String merchantCode, QueryNotifyReq req, PayTypeEnum type);
}
